
  
  <template>
  <div class="pageScroll">
    <el-card>
      <template #header>
        <div class="card-header flex">
          <div class="flex1">勋章管理</div>
          <el-button type="primary" @click="toEditPage()">新建勋章</el-button>
        </div>
      </template>

      <el-table :data="list" :loading="loading">
        <el-table-column
          label="序号"
          align="center"
          prop="_index"
          width="60px"
        />
        <el-table-column label="勋章名称" align="center" prop="name">
        </el-table-column>
        <el-table-column label="勋章图标" align="center" prop="iconUrl">
          <template #default="scope">
            <el-image style="width: 100px" :src="scope.row.iconUrl"></el-image>
          </template>
        </el-table-column>
        <el-table-column label="勋章图标2" align="center" prop="iconUrlC">
          <template #default="scope">
            <el-image style="width: 100px" :src="scope.row.iconUrlC"></el-image>
          </template>
        </el-table-column>
        <el-table-column label="对应积分" align="center" prop="integral">
        </el-table-column>
        <el-table-column label="创建人" align="center" prop="createByName">
        </el-table-column>
        <el-table-column
          label="创建时间"
          width="180px"
          align="center"
          prop="createTime"
        >
        </el-table-column>

        <el-table-column
          label="操作"
          fixed="right"
          align="center"
          width="120px"
        >
          <template #default="scope">
            <el-button
              link
              type="primary"
              @click="toEditPage(scope.row.id)"
              v-hasPermi="['infra:config:update']"
            >
              编辑
            </el-button>
            <!-- <el-button
              link
              type="danger"
              @click="handleDelete(scope.row.id)"
              v-hasPermi="['infra:config:delete']"
            >
              删除
            </el-button> -->
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
  
<script setup lang="ts">
import API from '@/api/api';
import { useListPage } from '@/hooks/useListPage';
const router = useRouter();
const {
  queryParams,
  queryFormRef,
  loading,
  list,
  handleQuery,
  resetQuery,
  handleDelete,
} = useListPage({
  queryApi: API.medalController.list,
});

function toEditPage(id?: number) {
  router.push({
    name: 'editXunzhang',
    query: {
      id,
    },
  });
}
</script>